package pl.edu.agh.student.model;

import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.security.management.RoleName;

@Entity
@Name("role")
@Table(name = "roles")
public class Role extends AbstractEntity {

    private String name;

    public Role() {
        super();
    }

    @RoleName
    @Length(max = 20)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    private List<User> users = new LinkedList<User>();

    @ManyToMany
    public List<User> getUsers() {
        return users;
    }

    public void setUsers(List<User> users) {
        this.users = users;
    }
    
    public String toString() {
    	return this.getClass().getSimpleName() + "[" + name + "]";
    }
}
